package structuralPattern.composite.example02;

public class Client {
    public static void main(String[] args) {
        // 根节点
        Entry root = new Directory("root");

        Entry bin = new Directory("bin");
        Entry vi = new File("vi", 10);
        Entry test = new File("test", 20);
        bin.add(vi);
        bin.add(test);

        Entry tmp = new File("tmp", 30);

        Entry usr = new Directory("usr");
        Entry mysql = new Directory("mysql");
        Entry conf = new File("my.conf",40);
        Entry db = new File("test.db",50);
        mysql.add(conf);
        mysql.add(db);
        usr.add(mysql);

        root.add(bin);
        root.add(tmp);
        root.add(usr);

        System.out.println(root.getName());
        System.out.println("==============");
        System.out.println(root.getSize());
        System.out.println("==============");
        root.printList("");
    }
}
